<%@ Page Language="C#"  MasterPageFile="~/Master.master" AutoEventWireup="true" CodeFile="Questionnaires.aspx.cs" Inherits="Control_Questionnaires" Title="Questionnaire" %>
<%@ MasterType VirtualPath="~/Master.master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <h1>Questionnaires</h1>
    
    <h2>To add a new questionnaire, please enter the following details:</h2>
    
    <div class="formInputTitle">Questionnaire name:</div>
    <asp:TextBox ID="txtQuestionnaire" runat="server" CssClass="formInput" onfocus="this.className='formInputOver';" onblur="this.className='formInput';"></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" ControlToValidate="txtQuestionnaire" ValidationGroup="Questionnaire"></asp:RequiredFieldValidator>
    
    <br /><br />
    
    <div class="formInputTitle">Leading text:</div>
    <asp:TextBox ID="txtLeadingText" runat="server" TextMode="MultiLine" CssClass="formInputLarge" onfocus="this.className='formInputLargeOver';" onblur="this.className='formInputLarge';"></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*" ControlToValidate="txtLeadingText" ValidationGroup="Questionnaire"></asp:RequiredFieldValidator>
    
    <br /><br />
    
    <div class="formInputTitle">Archive text:</div>
    <asp:TextBox ID="txtArchiveText" runat="server" TextMode="MultiLine" CssClass="formInputLarge" onfocus="this.className='formInputLargeOver';" onblur="this.className='formInputLarge';"></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="*" ControlToValidate="txtArchiveText" ValidationGroup="Questionnaire"></asp:RequiredFieldValidator>
    
    <br /><br />
    
    <div class="formInputTitle">Start date:</div>
    <asp:TextBox ID="txtStartDate" runat="server" CssClass="formInput" onfocus="this.className='formInputOver';" onblur="this.className='formInput';"></asp:TextBox>

    <br /><br />
    
    <div class="formInputTitle">End date:</div>
    <asp:TextBox ID="txtEndDate" runat="server" CssClass="formInput" onfocus="this.className='formInputOver';" onblur="this.className='formInput';"></asp:TextBox>
    <!--//(22/02/2007)//-->
    
    <br /><br />
    
    <div class="formInputTitle">Account:</div>
    <asp:DropDownList ID="ddlAccounts" runat="server" CssClass="formInput" onfocus="this.className='formInputOver';" onblur="this.className='formInput';">
    </asp:DropDownList>

    <p><asp:Button ID="btnCreate" ValidationGroup="Questionnaire" runat="server" Text="Create new questionnaire" OnClick="btnCreate_Click" /></p>
    
    <br />
    
    <h2>Existing questionnaires:</h2>
    
    <asp:GridView ID="gViewQuestionnaires" runat="server" AutoGenerateColumns="False" DataKeyNames="QuestionnaireID">

        <Columns>
            <asp:TemplateField HeaderText="QuestionnaireID" Visible="false">
                <ItemTemplate>
                    <a href='../Questionaire.aspx?ID=<%#Eval("QuestionnaireID")%>'><%#Eval("QuestionnaireID")%></a>
                </ItemTemplate>
            </asp:TemplateField>

            <asp:HyperLinkField DataTextField="QuestionnaireName" HeaderText="Name" DataNavigateUrlFields="QuestionnaireID"  DataNavigateUrlFormatString="../Questionaire.aspx?ID={0}"  />

            <asp:BoundField DataField="StartDate" HeaderText="Start date" HtmlEncode="false" DataFormatString="{0:d}" />
            <asp:BoundField DataField="EndDate" HeaderText="End date" HtmlEncode="false" DataFormatString="{0:d}" />
            
            <asp:TemplateField HeaderText="Leading text">
                <ItemTemplate>
                   <%# Eval("LeadingText").ToString().Replace(Environment.NewLine, "<br/>")%>
                </ItemTemplate>
            </asp:TemplateField>
            
            <asp:TemplateField HeaderText="Archive text">
                <ItemTemplate>
                   <%# Eval("ArchiveText").ToString().Replace(Environment.NewLine, "<br/>")%>
                </ItemTemplate>
            </asp:TemplateField>
            
            <asp:BoundField DataField="Archive" HeaderText="Archive" />
            
            <asp:HyperLinkField DataNavigateUrlFields="QuestionnaireID"  DataNavigateUrlFormatString="~/Control/EditQuestionnaire.aspx?ID={0}" DataTextField="QuestionnaireID"  DataTextFormatString="Detail" />
            <asp:HyperLinkField DataNavigateUrlFields="QuestionnaireID"  DataNavigateUrlFormatString="~/Control/Results.aspx?ID={0}" DataTextField="QuestionnaireID"  DataTextFormatString="view Report" />

        </Columns>
        
    </asp:GridView>

  </asp:Content>